import {request} from '../utils/request'
// 优惠劵网址
// const BASE_URL_RECEIVE = "http://dev.marketing.lbs.p.yufeiworld.com" 
// const BASE_URL_RECEIVE = "http://dev.gateway.lbs.p.yufeiworld.com"
const BASE_URL_RECEIVE = ""
/* 
 活动管理
*/
// 活动详情
export const requestMarkingActivityDetail = (id: number) => {
    return request({
        url: BASE_URL_RECEIVE + `/admin/marketing/marketingActivity/info/detail/${id}`,
        method: "GET",
        header: {
            'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
        }
    })
}

export type MarkingInfo = {
    activityName: string,
    businessId: number,
    channelType: number,
    deliveryChannel: number,
    endDate: string,
    pageNo: number,
    pageSize: number,
    startDate: string,
    status: number,
    type: number
}
// 查询活动列表
export const requestMarkingActivityList = (markingInfo: Partial<MarkingInfo>) => {
    return request({
        url: BASE_URL_RECEIVE + `/admin/marketing/marketingActivity/info/list`,
        method: "POST",
        data: markingInfo
    })
}

export type MarkingActivityInfo = {
    activityJson: string,
    activityName: string,
    activityTarget: string,
    businessId: number,
    deliveryChannel: number,
    describes: string,
    endDate: string,
    id: number,
    imgIds: string,
    marketingType: number,
    rewardCouponId: number,
    shareProfile: string,
    shareUrl: string,
    shopIds: string,
    startDate: string,
    targetCustomer: string
}
// 新增活动
export const requestMarkingActivityInfoSave = (markingActivityInfo: Partial<MarkingActivityInfo>) => {
    return request({
        url: BASE_URL_RECEIVE + `/admin/marketing/marketingActivity/info/save`,
        method: "POST",
        data: markingActivityInfo
    })
}


// 更新活动
export const requestMarkingActivityInfoUpdate = (markingActivityInfo: Partial<MarkingActivityInfo>) => {
    return request({
        url: BASE_URL_RECEIVE + `/admin/marketing/marketingActivity/info/update`,
        method: "POST",
        data: markingActivityInfo
    })
}


export type markingActivityStatus = {
    id: number,
    status: number
}
// 更新活动状态
export const requestMarkingActivityStatusUpdate = (markingActivityStatus: Partial<markingActivityStatus>) => {
    return request({
        url: BASE_URL_RECEIVE + `/admin/marketing/marketingActivity/info/updateStatus`,
        method: "POST",
        data: markingActivityStatus
    })
}